package android.apps.adapter;

import android.apps.R;
import android.apps.activity.AlbumItemActivity;
import android.apps.bean.MadeListItem;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

/**
 * 按地点排序；
 * Created by lcy on 2015/12/28.
 */
public class AlbumItemAdapter2 extends BaseAdapter {
    private LayoutInflater layoutInflater;
    private List<MadeListItem> mData;
    private Context mContext;

    public AlbumItemAdapter2(List<MadeListItem> madeList, Context context) {
        mData = madeList;
        mContext = context;
        layoutInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return mData.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Holder holder;
        if (convertView == null) {
            convertView = layoutInflater.inflate(R.layout.type_item_layout, parent, false);
            holder = new Holder();
            holder.describe = (TextView) convertView.findViewById(R.id.describe);
            holder.gridView = (GridView) convertView.findViewById(R.id.gridview);
            convertView.setTag(holder);
        } else {
            holder = (Holder) convertView.getTag();
        }
        holder.describe.setText(mData.get(position).getItemTypeAddr().replace(":","-"));
        holder.gridView.setAdapter(new GridAdapter2(mData.get(position).getItemList(),mContext));
        return convertView;
    }
    class Holder{
        TextView describe;
        GridView gridView;
    }
}
